﻿@{
    ViewBag.Title = "Danh mục sản phẩm";
}
<add assembly="PagedList.Mvc" namespace="PagedList.Mvc" tagPrefix="plmvc"/>
@using PagedList
@using PagedList.Mvc
<div class="main-holder">
    <div class="main-frame">
        <div id="content">
            <div class="content">
                <div class="box">
                    <h2>@ViewBag.Category.Name</h2>
                    <div class="holder">
                        <div class="frame-box">
                            <div class="blocks-holder">
                                @foreach (var p in ViewBag.Products)
                                {
                                    <div class="block">
                                        <figure>
                                            <img src="/Images/Products/img3.jpg" width="183" height="135" alt="" />
                                            <h3><a href="/Product/Detail/@p.Id">@p.Name</a></h3>
                                            @{string html = String.Format("{0:C}", p.CurrentPrice);}
                                            <span class="price">@html.Replace('$',' ') VNĐ</span>
                                           
                                        </figure>
                                        <div class="btns-holder">
                                            @if(@p.GetQuantity() <= 0 ) 
                                            { 
                                                @:<a href="#" class="add">hết hàng</a>
                                            }
                                            @if(@p.GetQuantity() > 0 ) 
                                            { 
                                                @:<a href="/Cart/AddToCart/@p.Id" class="add">Giỏ hàng</a>
                                            }
                                            <a href="/Product/Detail/@p.Id" class="detail">Chi tiết</a>
                                        </div>
                                    </div>
                                }
                            </div>
                            @Html.PagedListPager((IPagedList)ViewBag.Products, page => Url.Action("Category", new { page}), PagedListRenderOptions.OnlyShowFivePagesAtATime)
                        </div>
                    </div>
                </div>
            </div>

            <aside id="sidebar">
                @Html.Action("__CategoriesMenu","Product")
            </aside>
        </div>
    </div>
</div>
